package com.example.android.notepad;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.SimpleAdapter;

import java.util.List;
import java.util.Map;

public class Result extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        // 获取该intent所携带的数据
        Bundle data = intent.getExtras();
        // 从Bundle数据包中取出数据
        List<Map<String, String>> list = (List<Map<String, String>>) data.getSerializable("data");
        // 将List封装成SimpleAdapter
        SimpleAdapter adapter = new SimpleAdapter(Result.this,
                list, R.layout.result, new String[]{"title"}, new int[]{R.id.textView1});
        // 填充ListView
        this.setListAdapter(adapter);
    }
}
